<?php
Raise::load('core.ui.RaisePage');

/**
 * TestCoreRaiseTimer class
 * Testing unit of 'phpraise/core/RaisePage.php'
 *
 * @author Sam-Mauris Yong / hellclanner at live dot com
 * @license http://www.opensource.org/licenses/bsd-license New BSD License
 * @package Raise.UnitTest.Test
 */
class TestCoreRaisePage extends RaiseTest {
    
    public static function testClass(){
        self::assertClassExists('RaisePage');
        self::assertClassExtends('RaisePage', 'RaiseAction');
        self::assertClassIsAbstract('RaisePage');
        self::assertClassExists('MockRaisePage');
        self::assertClassExtends('MockRaisePage', 'RaisePage');
        
        self::assertClassMethod('RaisePage', array('params', 'title', 'output'));
        
        self::assertClassMethod('MockRaisePage', 'build');
    }
    
    public static function testParameters(){
        $mock = new MockRaisePage(array('t' => 5), 'test');
        self::assertObjectClass($mock->params(), 'RaiseCollection');
        self::assertStrictEqual($mock->params()->get('t'), 5);
        self::assertStrictEqual($mock->params()->count(), 1);
    }
    
    public static function testTemplate(){
        $mock = new MockRaisePage(array(), 'test {key}');
        $s = 'testing';
        $mock->title($s);
        self::assertStrictEqual($mock->title(), $s);
        self::assertObjectClass($mock->template(), 'RaiseTemplate');
        self::assertStrictEqual($mock->template()->parse(), 'test {key}');
        $mock->template()->fields()->add('key', 'test2');
        self::assertStrictEqual($mock->template()->parse(), 'test test2');
    }
    
}